package com.tiennt.android.callnotes.ui;

import com.tiennt.android.callnotes.R;
import com.tiennt.android.callnotes.utils.ProjectUtils;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class NoteViewLayout extends RelativeLayout {
	private Context mContext;
	private TextView txtTitle;
	private TextView txtContent;

	public NoteViewLayout(Context context) {
		super(context);
		mContext = context;
		// TODO Auto-generated constructor stub
		txtTitle = new TextView(mContext);
		txtContent = new TextView(mContext);
		stylingView();
	}

	private void stylingView() {
		this.setBackgroundResource(R.drawable.content_inner_dialog);
		LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
				LayoutParams.WRAP_CONTENT);
		params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
		params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);

		txtTitle.setLayoutParams(params);
		txtTitle.setBackgroundResource(R.drawable.content_inner_dialog_title);
		txtTitle.setTextColor(Color.parseColor("#FFFFFF"));
		txtTitle.setTextSize(16);
		txtTitle.setTypeface(null, Typeface.BOLD);
		txtTitle.setId(ProjectUtils.txtTitleId);
		addView(txtTitle);

		params = new LayoutParams(LayoutParams.WRAP_CONTENT,
				LayoutParams.WRAP_CONTENT);
		params.addRule(RelativeLayout.ALIGN_LEFT, txtTitle.getId());
		params.addRule(RelativeLayout.BELOW, txtTitle.getId());
		txtContent.setLayoutParams(params);
		txtContent.setTextColor(Color.parseColor("#4B4B4B"));
		addView(txtContent);
	}

	public void setText(String title, String content) {
		txtTitle.setText(title);
		txtContent.setText(content);
	}
}
